<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" session="false" %>
<%@ page import="com.atozsoft.commonutil.Constants"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@page import="com.eos.data.datacontext.UserObject" %>
<%@ page import="commonj.sdo.DataObject"%>
<%@page import="org.gocom.components.coframe.rights.dataset.CapUser"%>
<%@page import="java.math.BigDecimal"%>	
<%@ page import="com.eos.engine.component.ILogicComponent"%>
<%@ page import="com.primeton.ext.engine.component.LogicComponentFactory"%>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- 
  - Author(s): houfy
  - Date: 2016-10-25 14:23:02
  - Description:
-->
<head>
	<%@include file="/common.jsp"%>
	<%@include file="/common/common.jsp"%>
    <%@include file="/coframe/tools/skins/common.jsp"%>
	<title>五小成果管理详细</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script src="<%=request.getContextPath()%>/mis/js/uploadify/js/jquery-1.9.1.js" type="text/javascript"></script>
    <script src="<%=request.getContextPath()%>/mis/js/uploadify/js/jquery.uploadify-src.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/mis/js/uploadify/css/uploadify.css">
    <%
        // 来源操作flg
		String actionFlg = "";
		if(request.getParameter("actionFlg")!=null){
			actionFlg = (String)request.getParameter("actionFlg");
		}
		// 借款ID
		String projectestablishmentid = "";
		if(request.getParameter("projectestablishmentid")!=null){
			projectestablishmentid = (String)request.getParameter("projectestablishmentid");
		}
    	
    	//===== BEG 添加流程实例ID为传入参数，用于查询实体数据  add 2014-12-09 houfy
    	//流程实例ID
 	 	String processInstId = "";
		if(request.getParameter("processInstId")!=null){
			processInstId = (String)request.getParameter("processInstId");
		}
		
		//流程实例工作项ID
 	 	String workitemid = "";
		if(request.getParameter("workitemid")!=null){
			workitemid = (String)request.getParameter("workitemid");
		}
 	 	//===== END 添加流程实例ID为传入参数，用于查询实体数据  add 2014-12-09 houfy
	%>
</head>
<body>
	<div id="showbtnArea" class="nui-toolbar" style="padding:0px;" borderStyle="border:0;">
			<table width="100%">
		    	<tr>
		        	<td style="text-align:right;">
		          		<a id="editBtn" class="nui-button" iconCls="icon-edit" onclick="onEdit">编辑</a>
		          		<span style="display:inline-block;width:10px;"></span>
		          		<a id="okBtn" class="nui-button" iconCls="icon-save" onclick="onOk">保存</a>
		          		<span style="display:inline-block;width:10px;"></span>
		       		    <a id="submitBtn" class="nui-button" style="width:60px;" iconCls="icon-upload" onclick="submit()">提交</a>
		        	</td>
		      	</tr>
		    </table>
		</div>
	<div id="editLoanForm" style="padding-top:30px;">
		<!-- 借款ID -->
  		<input id="projectestablishmentid" class="nui-hidden" name="loan.projectestablishmentid"/>
		<!--历史版本号 -->
  		<input id="history" class="nui-hidden" name="loan.history"/>
    	<table style="width:100%;height:100%;table-layout:fixed;" class="nui-form-table">
      		<tr>
      			<th class="nui-form-label">成果编码：</th>
        		<td>
          			<input id="projectestablishmentcode" class="nui-textbox nui-form-input" name="loan.projectestablishmentcode"/>
        		</td>
        		<th class="nui-form-label"><font color="red">*</font>&nbsp;单位：</th>
        		<td>
          			<input id="projectname" class="nui-textbox nui-form-input" style="width:100%;" name="loan.projectname"  required="true" requiredErrorText="项目名称不能为空！"/>
        		</td>
      		</tr>
      		<tr class="odd">
      			<th class="nui-form-label">项目名称：</th>
        		<td>
        			<input id="triptheme" class="nui-textbox nui-form-input" name="loan.triptheme" textName="loan.triptheme"  style="width: 100%;"/>
			       
        		</td>
        		<th class="nui-form-label">主要完成人：</th>
        		<td>
        			<input id="triptheme" class="nui-textbox nui-form-input" name="loan.triptheme" textName="loan.triptheme"  style="width: 100%;"/>
			       
        		</td>
      		</tr>
      		<tr>
      			<th class="nui-form-label">技术问题联系人：</th>
        		<td>
        			<input id="triptheme" class="nui-textbox nui-form-input" name="loan.triptheme" textName="loan.triptheme"  style="width: 100%;"/>
        		</td>
        		<th class="nui-form-label">手机：</th>
        		<td>
        			<input id="triptheme" class="nui-textbox nui-form-input" name="loan.triptheme" textName="loan.triptheme"  style="width: 100%;"/>
			       
        		</td>
      		</tr>	
      		<tr class="odd">
      			<th class="nui-form-label">座机：</th>
        		<td>
        			<input id="triptheme" class="nui-textbox nui-form-input" name="loan.triptheme" textName="loan.triptheme"  style="width: 100%;"/>
        		</td>
        		<th class="nui-form-label">电子邮箱：</th>
        		<td>
        			<input id="triptheme" class="nui-textbox nui-form-input" name="loan.triptheme" textName="loan.triptheme"  style="width: 100%;"/>
			       
        		</td>
      		</tr>
      		<tr>
      			<th class="nui-form-label">完成时间：</th>
        		<td>
        			<input id="startDate" class="nui-datepicker" style="width:100%;" allowInput="false"/>
			       
        		</td>
      			<th class="nui-form-label">状态：</th>
        		<td>
        			<input id="ifproject" class="nui-dictcombobox nui-form-input" name="costreport.ifproject" showNullItem="true" dictTypeId="PROCESS_STATUS_TYPE" />
        		</td>
      		</tr>
        	<tr class="odd">
        		<th class="nui-form-label"  nowrap="nowrap">所属技术领域：</th>
        		<td colspan="3">
          			 <input id="triptheme" class="nui-textbox nui-form-input" name="loan.triptheme" textName="loan.triptheme"  style="width: 100%;"/>
        		</td>
        	</tr>
      		<tr>
        		<th class="nui-form-label">立项背景：</th>
        		<td  colspan="3">
          			<input id="remark" class="nui-textarea nui-form-input" name="loan.remark" vtype="rangeChar:0,1300" rangeCharErrorText="备注长度不能超过1300！"/>
          			<!-- 附件 -->
          			<input id="attachment" class="nui-hidden" name="loan.attachment"/>
        		</td>
      		</tr>
      		<tr class="odd">
        		<th class="nui-form-label">备注：</th>
        		<td  colspan="3">
          			<input id="remark" class="nui-textarea nui-form-input" name="loan.remark" vtype="rangeChar:0,1300" rangeCharErrorText="备注长度不能超过1300！"/>
          			<!-- 附件 -->
          			<input id="attachment" class="nui-hidden" name="loan.attachment"/>
        		</td>
      		</tr>
    	</table>
		<div style="width:100%;padding:2px 0px 0px 0px;">
			<div class="nui-toolbar" style="border-bottom:0;">
	        	<table style="width:100%;">
	            	<tr>
			            <td style="width:50%;">
			                <a class="nui-button" id="uploadify">上传</a>
			            	<a id="deleteFile" class="nui-button" onclick="removeFile()" style="margin-left: 85px; width:60px;">删除</a>
			            </td>
				    	<th align="left">附件</th>
		            </tr>
		        </table>
	    	</div>
	    </div>
    	<div class="nui-fit" style="width:100%;min-height: 83px;height: 85px;">
  			<div id="attachmentDatagrid" class="nui-datagrid" style="width:100%;height:100%" sizeList="[5,10,20,50]"  
  				idField="fileid" dataField="cmFiles" url="com.austar.cm.common.queryUplodeFileListByIds.biz.ext" 
		    	allowResize="false" showPager="false" showReloadButton="false" totalField="total" multiSelect="true">
		    	<div property="columns">
		        	<div field="fileid" visible="false">ID</div>
		        	<div field="filepath" visible="false">路径</div>
          			<div name="checkcolumn" type="checkcolumn" headerAlign="center" width="10px" align="center"></div>
		        	<div type="indexcolumn" headerAlign="center" width="20px" align="center">序号</div>
		        	<div field="uploadname" headerAlign="center" allowSort="true" renderer="renderOnfileName">文件名称</div>
		    	</div>
			</div>
	    </div>
	</div>
	<script type="text/javascript">
    	nui.parse();
    	//隐藏出差申请详细查看按钮
    	document.getElementById("viewTripApply").style.display="none";
    	document.getElementById("triptheme").style.width="100%";
    	var form = new nui.Form("#editLoanForm");
    	var grid = nui.get("attachmentDatagrid");
    	var actionFlg="<%=actionFlg%>";
    	var projectestablishmentid="<%=projectestablishmentid%>";
    	var uploadFlg = true;
    	var processInstId = "<%=processInstId %>" ;
    	 
    	if(actionFlg=="add")
    	{
    	
		    setViewClass(actionFlg);
    	}
    	
    	// 存在借款ID时为修改，需要初始数据
    	var processInstId = "<%=processInstId %>" ;
	    var processinstid = "";
	    var workitemid ="<%=workitemid%>";
    	
    	if((projectestablishmentid!=null && projectestablishmentid!= '') || (processInstId!=null && processInstId!= "")){
    		//从流程业务关系表中查询关系数据
    		if (processInstId!=null && processInstId!= ""){
    			var processJson =  nui.encode({processInstId:processInstId});
    			//nui.alert(nui.encode(processJson));
    			$.ajax({
			        url:"com.atozsoft.wf.processOperate.queryProcessBusinessRelationByID.biz.ext",
			        type:'POST',
			        data:processJson,
			        cache:false,
			        async:false,// 禁止异步加载
			        contentType:'text/json',
			        success:function(text){
			        	tripabroadId = text.pBusiness.keyvalue;
			        },
	                error: function () {
	                	nui.alert("数据异常！", "提示");
	                }
		      	});
    		}
	
    		var loanJson  = nui.encode({projectestablishmentid:projectestablishmentid,processInstId:processInstId});
    		if(projectestablishmentid!=null && projectestablishmentid!= ''){
    			loanJson  = nui.encode({projectestablishmentid:projectestablishmentid});
    		}
    		
    	}
    	

    	// 编辑按钮切换样式
	    function onEdit(){
	    	setViewClass('viewUpdate');
	    }
	    
	    //放弃
	    function onReset(){
	    	post('projectEstablishment_detail.jsp', {actionFlg: 'view',projectestablishmentid : "<%=projectestablishmentid%>"});
	    }
	    
	     //删除出差申请数据
	    function onDelete(){
	    	
	    }
	    
	    // 设置编辑样式
		function setViewClass(flg){
	      
	    }
    	
    	//PROCESS BEG ============== 流程操作代码 ==============
    	var processInstId = "<%=processInstId %>" ;
	    var nowWorkItem = [];
  		var workitemid = "<%=workitemid%>";
	    //获取当前工作项是否为发起节点
	    if((workitemid!=null && workitemid!= "") && (processInstId!=null && processInstId!= "")){
        	
        }	
		
    	// 设置不可编辑样式
        function noEdit(){
		    
        }
        //PROCESS BEG ============== 流程操作代码 ==============
	    
	    // 保存并提交按钮
		// 下一工作项提示内容
		var NWuser = "";
		
		// 提交
	    function submit(){
	    	
	    }
	    
	   

	    // 流程执行父页面调用接口
        parent["infoFrame"] = window;
         // 父页面调用的字段控制操作
        // 01 显示 工时（workhours）字段
	    //传递控制参数
       var parentWorkType = "2345";
       
       function onParentCallCheck(){
       		var str = "false";
	        return str;
       	}
       
        // 父页面调用的保存操作，同意操作打开之前执行
	    function onParentCallOk(){
	        // 设定保存返回值   
        	var resultStr = "";
	        return resultStr;
	    }
	    
	    // 工作项确认同意后调用的操作
	    function onParentCallAfterOk(){
	    }
	    
	    // 等待提示
		function loading(){
			nui.mask({el: document.body,cls: 'mini-mask-loading',html: '处理中...'});
		}
		
		// 结束等待提示
	    function endLoading(){
	    	nui.unmask(document.body);
    	}
    	
	    // 流程完成后，打开页面查看时调用的操作
	    function onParentCallAfterStop(){
	    	
	    }
	    
	    // 父页面调用的打印操作
	    function onParentCallPrint(){
	    	//parent.printPage();
	    }
	    
	    // 更新流程业务关系表
	    function updatePBRelation(){
	    }

	    
	    function getNowFormatDate(){
		    var date = new Date();
		    var seperator1 = "-";
		    var seperator2 = ":";
		    var month = date.getMonth() + 1;
		    var strDate = date.getDate();
		    if (month >= 1 && month <= 9) {
		        month = "0" + month;
		    }
		    if (strDate >= 0 && strDate <= 9) {
		        strDate = "0" + strDate;
		    }
		    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
		            + " " + date.getHours() + seperator2 + date.getMinutes()
		            + seperator2 + date.getSeconds();
		    return currentdate;
		} 
	    
	  	//PROCESS END ============== 流程操作代码 ==============
    	
    	setViewClass(actionFlg);

    	// 保存按钮
	    function onOk(){
	    }
	    
        // 保存表单数据
		function saveData(compareType) {
			
	    }
	  	
      	/** 
         * 将千分位格式的数字字符串转换为浮点数 
         * @public 
         * @param string sVal 数值字符串 
         * @return float 
         */  
		function delcommafy(num)
		{
		 	//var fTmp = parseFloat(num.replace(/,/g, ''));  
            //return (isNaN(fTmp) ? 0 : fTmp);  
		    var num = num.replace(/,/g, '');  
            return num;  
		}
		
		
    </script>
</body>
</html>